var tetrisBoardTestCase = {};

var TetrisBoard = it.koutifaris._tetris.TetrisBoard;
var srsRotationSystem = new it.koutifaris._tetris.SRSRotationSystem();
var PieceType = it.koutifaris._tetris.PieceType;
var TetrisPiece = it.koutifaris._tetris.TetrisPiece;

tetrisBoardTestCase.getTestCaseName = function() {
	return "TetrisBoard Test";
};

tetrisBoardTestCase.setUp = function() {
	tetrisBoardTestCase.board = new TetrisBoard(10);
};

tetrisBoardTestCase.testPlaceIElement = function() {
	var piece = new TetrisPiece(PieceType.I, srsRotationSystem);
	piece.setPosition(-2, 0);

	tetrisBoardTestCase.board.placeElement(piece);

	for ( var i = 0; i < 4; i++) {
		assertNotNull(tetrisBoardTestCase.board.piecesStack.get(0, i), i + " position must not be null");
	}
};

tetrisBoardTestCase.testPlaceOElement = function() {
	var piece = new TetrisPiece(PieceType.O, srsRotationSystem);
	piece.setPosition(0, 0);

	tetrisBoardTestCase.board.placeElement(piece);

	console.log(tetrisBoardTestCase.board);
	for ( var i = 0; i < 2; i++) {
		assertNotNull(tetrisBoardTestCase.board.piecesStack.get(0, i), "(0," + i + ") position must not be null");
		assertNotNull(tetrisBoardTestCase.board.piecesStack.get(1, i), "(1," + i + ") position must not be null");
	}
};